// ==UserScript==
// @name         小说 - 脚本 - 设置页面的文本样式
// @namespace    http://tampermonkey.net/
// @version      2023-12-27
// @description  try to take over the world!
// @author       You
// @match        http://*/*
// @match        https://*/*
// @icon         http://wuweijun.fun/favicon.ico
// @grant        none
// ==/UserScript==

(function () {
  'use strict';
  var qidong = [/小说|文学|笔趣阁|顶点|章节/, /第.{1,8}章/, /第.{1,8}节/], falg = true;
  for (let i = 0; i < qidong.length; i++) { if (qidong[i].test(document.title)) { falg = false; break; } }
  if (falg) return;

  // 创建新的style标签
  var style = document.createElement('style');
  // 内容文本样式
  let target = [
      '#booktxt',
      '#txt',
      '#novelcontent p',
      '#contents',
      '#chaptercontent',
      '.chapter-content',
      '#TextContent',
      '#booktxt',
      '.txtnav',
      '.info_dv1.ov p',
      '.content',
      '#content',
      '.content p',
      '#content p',
      '.nr_all c_nr',
      '#txtContent',
      '#zjny',
      '#BookText',
      '.content-body',
      '.con',
      '.main p',
      '.word_read p',
  ].join(',')
  var styleString = `
    text-indent: 2em !important;
    letter-spacing: 5px !important;
    font-size: 39px !important;
    font-family: SourceHanSansSC-Regular, SourceHanSansCN-Regular, PingFangSC-Regular, \"Microsoft YaHei\", system-ui, -apple-system, \"Segoe UI\", Roboto, Emoji, Helvetica, Arial, sans-serif !important;
    color: rgb(54 39 39 / 90%) !important;
    line-height: 1.8 !important;
    margin-bottom: 57px !important;
`
  // 小说标题的样式
  let titleStyle = [
      '.breadcrumb',
      '.panel-heading',
      '.container h1',
  ].join(',');
  let titleStyleString = `
    letter-spacing: 5px !important;
    font-size: 39px !important;
    line-height: 1.8 !important;
`

  // 宽度
  let widht = [
      // "#novelbody",
      // ".container",
      //"#pageRead",
      // "body",
  ].join(',');
  let widthString = `
    width: 1071px !important;
`

// 设置样式内容
try {
    style.innerHTML = `
    ${target} {${styleString}}
    ${titleStyle} {${titleStyleString}}
    ${widht} {${widthString}}
    `;
} catch (error) { }

  // 将style标签添加到head元素中
  for (let i = 0; i < qidong.length; i++) {
      if (qidong[i].test(document.title)) {
          document.head.appendChild(style);
          break;
      }
  }


  // Your code here...
}
)();
